<template>
  <view class="wrap">
    <!--        空数据-->
    <view v-if="!detail" class="first-tip">
      首次生成<text style="color: red">{{tabItem.label}}</text>
      风控报告，会产生<text style="color: red">费用</text>，
      点击生成报告按钮，即可获取司法报告。
    </view>

    <!-- 司法列表 -->
    <view v-if="tabItem.riskKey==='law_list_risk' && detail">
      <view class="item" v-for="(e, i) in detail" :key="i">
        <view class="item-row">
          <view class="l">
            标题
          </view>
          <view class="r">
            {{ e.title }}
          </view>
        </view>
        <view class="item-row">
          <view class="l">
            内容
          </view>
          <view class="r">
            {{ e.body }}
          </view>
        </view>
        <view class="item-row">
          <view class="l">
            类型
          </view>
          <view class="r">
            {{ dataType[e.dataType] }}
          </view>
        </view>
        <view class="item-row">
          <view class="l">
            匹配度
          </view>
          <view class="r">
            {{ e.matchRatio }}
          </view>
        </view>
        <view class="item-row">
          <view class="l">
            时间
          </view>
          <view class="r">
            {{ e.sortTimeString }}
          </view>
        </view>
        <view class="btn-box">
          <view class="btn-color" @click.stop="getDetail(e)">查看详情</view>
        </view>
      </view>
    </view>

<!--    司法数据v2-->
    <view v-else-if="tabItem.riskKey==='law_data_risk' && detail">
      <scroll-view class="tab-scroll" scroll-x="true">
        <view class="tab-box h-100 w-full px-32 fs-26">
          <text v-for="(item,index) in menu" :key="item.name" :class="{'active':item.name === active}" @click="handleSelect(item.name)">
            {{item.title}}
            <view class="badge-box">
              <uni-badge class="uni-badge-left-margin" v-if="detail[item.name]&&detail[item.name].cases.length>0" :text="detail[item.name].cases.length"></uni-badge>
            </view>
          </text>
        </view>
      </scroll-view>
      <view v-if="detail[active]&&detail[active].cases">
        <view class="item" v-for="(e, i) in detail[active].cases" :key="i">
          <view class="item-row">
            <view class="l">
              案号
            </view>
            <view class="r">
              {{e.c_ah}}
            </view>
          </view>
          <view class="item-row">
            <view class="l">
              立案案由
            </view>
            <view class="r">
              {{e.n_laay_tree}}
            </view>
          </view>
          <view class="item-row">
            <view class="l">
              法院层级
            </view>
            <view class="r">
              {{e.n_jbfy_cj}}
            </view>
          </view>
          <view class="item-row">
            <view class="l">
              经办法院
            </view>
            <view class="r">
              {{e.n_jbfy}}
            </view>
          </view>
          <view class="item-row">
            <view class="l">
              类型
            </view>
            <view class="r">
              {{e.n_ajlx}}
            </view>
          </view>
          <view class="item-row">
            <view class="l">
              立案时间
            </view>
            <view class="r">
              {{e.d_larq}}
            </view>
          </view>
          <view class="item-row">
            <view class="l">
              状态
            </view>
            <view class="r">
              {{e.n_ajjzjd}}
            </view>
          </view>

          <view class="item-second" v-for="(a,j) in e.c_dsrxx" :key="j">
            <view class="item-row">
              <view class="l">
                名称
              </view>
              <view class="r">
                {{a.c_mc}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                当事人类型
              </view>
              <view class="r">
                {{a.n_dsrlx}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                诉讼地位
              </view>
              <view class="r">
                {{a.n_ssdw}}
              </view>
            </view>
          </view>

          <view v-if="['civil', 'administrative','jurisdict', 'compensate'].indexOf(active) > -1">
            <view class="item-row">
              <view class="l">
                起诉金额
              </view>
              <view class="r">
                {{e.n_qsbdje}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                起诉金额等级
              </view>
              <view class="r">
                {{e.n_qsbdje_level}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                胜诉估计
              </view>
              <view class="r">
                {{e.n_pj_victory}}
              </view>
            </view>
          </view>

          <view v-if="active == 'criminal'">
            <view class="item-row">
              <view class="l">
                定罪罪名
              </view>
              <view class="r">
                {{e.n_dzzm}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                定罪罪名详细
              </view>
              <view class="r">
                {{e.n_dzzm_tree}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                犯罪金额
              </view>
              <view class="r">
                {{e.n_fzje}} / {{e.n_fzje_level}} 级
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                请求赔偿金额
              </view>
              <view class="r">
                {{e.n_bqqpcje}} / {{e.n_bqqpcje_level}} 级
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                判处赔偿金额
              </view>
              <view class="r">
                {{e.n_pcpcje}} / {{e.n_pcpcje_level}} 级
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                刑执行金额
              </view>
              <view class="r">
                {{e.n_ccxzxje}} / {{e.n_ccxzxje_level}} 级
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                判处结果
              </view>
              <view class="r">
                {{e.n_pcjg}}
              </view>
            </view>
          </view>

          <view v-if="active == 'preservation'">
            <view class="item-row">
              <view class="l">
                申请保全数额
              </view>
              <view class="r">
                {{e.n_sqbqse}} / {{e.n_sqbqse_level}} 级
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                申请保全标的物
              </view>
              <view class="r">
                {{e.c_sqbqbdw}}
              </view>
            </view>
          </view>

          <view v-if="active == 'implement'">
            <view class="item-row">
              <view class="l">
                申请执行标的金额
              </view>
              <view class="r">
                {{e.n_sqzxbdje}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                实际到位金额
              </view>
              <view class="r">
                {{e.n_sjdwje}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                未执行金额
              </view>
              <view class="r">
                {{e.n_wzxje}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                审理信息
              </view>
              <view class="r">
                {{e.c_slfsxx}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                审理程序
              </view>
              <view class="r">
                {{e.n_slcx}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                所属地域
              </view>
              <view class="r">
                {{e.c_ssdy}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                诉讼地位
              </view>
              <view class="r">
                {{e.n_ssdw}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                相关案号
              </view>
              <view class="r">
                {{e.c_gkws_glah}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                一审诉讼地位
              </view>
              <view class="r">
                {{e.n_ssdw_ys}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                结案案由
              </view>
              <view class="r">
                {{e.n_jaay}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                结案方式
              </view>
              <view class="r">
                {{e.n_jafs}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                结案时间
              </view>
              <view class="r">
                {{e.d_jarq}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                结案金额
              </view>
              <view class="r">
                {{e.n_jabdje}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                结案金额等级
              </view>
              <view class="r">
                {{e.n_jabdje_level}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                当事人段落
              </view>
              <view class="r">
                {{e.c_gkws_dsr}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                结案案由详细
              </view>
              <view class="r">
                {{e.c_gkws_pjjg}}
              </view>
            </view>
            <view class="item-row">
              <view class="l">
                判决结果段落
              </view>
              <view class="r">
                {{e.n_jaay_tree}}
              </view>
            </view>
          </view>


        </view>

      </view>
    </view>

    <view class="footer">
      <view class="btn">
        <!-- 更新按钮：判断每个风控：是不是第一次生成报告（显示不同文案）-->
        <view v-for="item in riskTabList" :key="item.riskKey">
          <view class="btn-color" v-if="item.value==tabItem.value" @click="$refs.popModel.open()">
            {{nowItem.risk_status[item.riskKey]===1?'更新报告':'首次生成报告'}}
          </view>
        </view>
      </view>
    </view>
    <uni-popup ref="popModel" type="center"
               :maskClick="false"
               border-radius="10px 10px 0 0">
      <view class="pop-box">
        <view class="title">提示</view>
        <view class="content">
          是否更新
          <text style="color:red">{{tabItem.label}}</text>
          ？获取最新报告，本次更新会产生<text style="color:red">费用</text>。
        </view>
        <view class="btn-box">
          <view class="btn cancel" @click="$refs.popModel.close()">取消</view>
          <view class="btn confirm" @click="getNewRisk(tabItem.value)">确定</view>
        </view>
      </view>
    </uni-popup>

<!--  司法详情提示扣费  -->
    <uni-popup ref="detailFeeModel" type="center"
               :maskClick="false"
               border-radius="10px 10px 0 0">
      <view class="pop-box">
        <view class="title">提示</view>
        <view class="content">
          查看司法详情会产生<text style="color:red">费用</text>，是否继续？
        </view>
        <view class="btn-box">
          <view class="btn cancel" @click="$refs.detailFeeModel.close()">取消</view>
          <view class="btn confirm" @click="getDetailFee(listItem)">确定</view>
        </view>
      </view>
    </uni-popup>

<!--    司法详情-->
    <uni-popup ref="detailModel" type="center"
               :maskClick="false"
               border-radius="10px 10px 0 0">
      <view class="pop-box">
        <view class="title">司法详情</view>
        <view class="content">
<!--          裁判文书-->
          <view class="item" v-for="(item, index) in listDetail['cpws']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">审判</view>
              <view class="r">
                {{ item.judge }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">判决结果</view>
              <view class="r">
                {{ item.judgeResult }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">审理状态</view>
              <view class="r">
                {{ item.trialProcedure }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">审结日期</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">案由</view>
                <view class="r">
                  {{ jtem.caseCauseT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">代字</view>
                <view class="r">
                  {{ jtem.caseNoKwordT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">文书类型</view>
                <view class="r">
                  {{ jtem.caseTypeT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">主体类型</view>
                <view class="r">
                  {{ jtem.partyType }}
                </view>
              </view>
            </view>
          </view>
<!--          失信公告-->
          <view class="item" v-for="(item, index) in listDetail['shixin']" :key="index">
            <view class="item-row">
              <view class="l">
                类型
              </view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">发布时间</view>
              <view class="r">
                {{ formatTime(item.postTime,'millisecond') }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">立案时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">代字</view>
                <view class="r">
                  {{ jtem.caseNoKwordT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">身份证号码</view>
                <view class="r">
                  {{ jtem.idcardNo }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">具体情形</view>
                <view class="r">
                  {{ jtem.jtqx }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">履行情况</view>
                <view class="r">
                  {{ jtem.lxqkT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">涉案金额</view>
                <view class="r">
                  {{ jtem.money }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">主体类型</view>
                <view class="r">
                  {{ jtem.partyType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
            </view>
          </view>
<!--          执行公告-->
          <view class="item" v-for="(item, index) in listDetail['zxgg']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
            <view class="l">申请人</view>
            <view class="r">
              {{ item.proposer }}
            </view>
          </view>
            <view class="item-row">
              <view class="l">立案日期</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">案件状态</view>
                <view class="r">
                  {{ jtem.caseStateT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">执行金额</view>
                <view class="r">
                  {{ jtem.execMoney }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">身份证号码</view>
                <view class="r">
                  {{ jtem.idcardNo }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">主体类型</view>
                <view class="r">
                  {{ jtem.partyType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">主体类型</view>
                <view class="r">
                  {{ jtem.partyType }}
                </view>
              </view>
            </view>
          </view>
<!--          开庭公告-->
          <view class="item" v-for="(item, index) in listDetail['ktgg']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">开庭时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">案由</view>
                <view class="r">
                  {{ jtem.caseCauseT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">代字</view>
                <view class="r">
                  {{ jtem.caseNoKwordT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当前称号</view>
                <view class="r">
                  {{ jtem.partyTitleT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
            </view>
          </view>
<!--          案件流程-->
          <view class="item" v-for="(item, index) in listDetail['ajlc']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">组织者</view>
              <view class="r">
                {{ item.organizer }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">案件时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">案件状态</view>
                <view class="r">
                  {{ jtem.caseStateT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">案由</view>
                <view class="r">
                  {{ jtem.caseCauseT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">代字</view>
                <view class="r">
                  {{ jtem.caseNoKwordT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当前称号</view>
                <view class="r">
                  {{ jtem.partyTitleT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">审理状态</view>
                <view class="r">
                  {{ jtem.trialProcedureS }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">审理状态</view>
                <view class="r">
                  {{ jtem.trialProcedureS }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">主体类型</view>
                <view class="r">
                  {{ jtem.partyType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当前称号</view>
                <view class="r">
                  {{ jtem.partyTitleT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
            </view>
          </view>
<!--          法院公告-->
          <view class="item" v-for="(item, index) in listDetail['fygg']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">立案时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">案由</view>
                <view class="r">
                  {{ jtem.caseCauseT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">代字</view>
                <view class="r">
                  {{ jtem.caseNoKwordT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">公告类型</view>
                <view class="r">
                  {{ jtem.ggTypeT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当前称号</view>
                <view class="r">
                  {{ jtem.partyTitleT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
            </view>
          </view>
<!--          曝光台-->
          <view class="item" v-for="(item, index) in listDetail['bgt']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">申请人</view>
              <view class="r">
                {{ item.proposer }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">立案时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
            <view class="item-second" v-for="(jtem,jndex) in item.partys" :key="jndex">
              <view class="item-row">
                <view class="l">地址</view>
                <view class="r">
                  {{ jtem.address }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">案由</view>
                <view class="r">
                  {{ jtem.caseCauseT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">代字</view>
                <view class="r">
                  {{ jtem.caseNoKwordT }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">标的金额</view>
                <view class="r">
                  {{ jtem.execMoney }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">身份证号码</view>
                <view class="r">
                  {{ jtem.idcardNo }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">主体类型</view>
                <view class="r">
                  {{ jtem.partyType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">当事人名称</view>
                <view class="r">
                  {{ jtem.pname }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">大类</view>
                <view class="r">
                  {{ jtem.ruleMainType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">小类</view>
                <view class="r">
                  {{ jtem.ruleSubType }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号描述</view>
                <view class="r">
                  {{ jtem.signalDesc }}
                </view>
              </view>
              <view class="item-row">
                <view class="l">信号等级</view>
                <view class="r">
                  {{ jtem.signalRating }}
                </view>
              </view>
            </view>
          </view>
<!--          司法查冻扣-->
          <view class="item" v-for="(item, index) in listDetail['sifacdk']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">当事人</view>
              <view class="r">
                {{ item.pname }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">资产类别</view>
              <view class="r">
                {{ item.action }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">金额</view>
              <view class="r">
                {{ item.money }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的名称</view>
              <view class="r">
                {{ item.objectName }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的类型</view>
              <view class="r">
                {{ item.objectType }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">事件日期</view>
              <view class="r">
                {{ item.eventDate }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">审结时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
          </view>
<!--          拍卖公告-->
          <view class="item" v-for="(item, index) in listDetail['pmgg']" :key="index">
            <view class="item-row">
              <view class="l">
                标题
              </view>
              <view class="r">
                {{ item.title }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">类型</view>
              <view class="r">
                {{ dataType[item.dataType] }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">法院</view>
              <view class="r">
                {{ item.court }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的物详细地址</view>
              <view class="r">
                {{ item.address }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的物起拍价</view>
              <view class="r">
                {{ item.auctionAmount }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的物性质</view>
              <view class="r">
                {{ item.auctionType }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">所有权人证件号码</view>
              <view class="r">
                {{ item.idCardNo }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的物名称</view>
              <view class="r">
                {{ item.lot }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">拍卖标的物详细描述</view>
              <view class="r">
                {{ item.lotInfo }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">标的物面积</view>
              <view class="r">
                {{ item.measure }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">拍卖标的所有权人</view>
              <view class="r">
                {{ item.pname }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">拍卖标的权证号</view>
              <view class="r">
                {{ item.powerNo }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">发布日期</view>
              <view class="r">
                {{formatTime(item.postTime,'millisecond') }}
              </view>
            </view>
            <view class="item-row">
              <view class="l">拍卖时间</view>
              <view class="r">
                {{ formatTime(item.sortTime,'millisecond') }}
              </view>
            </view>
          </view>


        </view>
        <view class="btn-box">
          <view class="btn cancel" @click="$refs.detailModel.close()">关闭</view>
        </view>
      </view>
    </uni-popup>
  </view>
</template>

<script>
import UniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue";
import {formatTime} from "../../../utils/order";
import {getNewRisk, getRisk} from "../../../api/admin";

export default {
  props: {
    user: { type: Object|null, default: () => null },
    nowItem: { type: Object|null, default: () => null },
    tabItem: { type: Object|null, default: () => null },
  },
  components: {UniPopup},
  data() {
    return {
      detail: '',
      active: 'civil',
      menu: [
        { name: 'civil', title: '民事案件' },
        { name: 'criminal', title: '刑事案件' },
        { name: 'administrative', title: '行政案件' },
        { name: 'preservation', title: '非诉保全审查' },
        { name: 'implement', title: '执行案件' },
        { name: 'bankrupt', title: '清算与破产案件' },
        { name: 'jurisdict', title: '管辖案件' },
        { name: 'compensate', title: '赔偿案件' }
      ],
      dataType: {
        cpws: '裁判文书',
        ktgg: '开庭公告',
        zxgg: '执行公告',
        shixin: '失信公告',
        fygg: '法院公告',
        ajlc: '案件流程',
        bgt: '曝光台',
        sifacdk: '司法查冻结',
        pmgg: '拍卖公告',
      },
      riskTabList:[
        {
          label:'司法数据（简版）',
          value:6,
          riskKey:'law_list_risk'
        },
        {
          label:'司法数据（详版）',
          value:5,
          riskKey:'law_data_risk'
        },
      ],
      tipShow:false,
      detailShow:false,
      listDetail:'',
      listItem:{},
      test:1
    }
  },
  onLoad(){
  },
  watch:{
    // tab切换
    tabItem(){
      this.detail=''
      this.getRisk(this.tabItem.value)
    }
  },
  mounted() {
    this.getRisk(this.tabItem.value)
  },
  methods: {
    formatTime,
    handleSelect(name) {
      this.active = name
    },
    getRisk(type,law_id){
      if(this.nowItem.risk_status[this.tabItem.riskKey]===0){
        return
      }
      getRisk({
        uid:this.nowItem.uid,
        order_id:this.nowItem.id,
        type:type,
        law_id:law_id
      }).then(res=>{
        if(res.status===200){
          // 司法列表
          if(type===6){
            this.detail = res.data.allList
          }
          // 司法列表详情
          if(type===7){
            this.listDetail = res.data.resp_data
            this.$refs.detailModel.open()
            // 更新列表 获取最新数据
            this.getRisk(6)
          }
          // 司法数据
          if(type===5){
            this.detail = res.data.detail
          }
        }
      })
    },

    // 查看司法详情
    getDetail(item){
      this.listItem=item
      let that=this
      // 提示扣费
      if(item.is_fee===1){
        this.$refs.detailFeeModel.open()
        return
      }
      this.getRisk(7,`${item.dataType}:${item.entryId}`)
    },
    // 提示扣费后请求司法详情
    getDetailFee(item){
      this.getRisk(7,`${item.dataType}:${item.entryId}`)
      this.$refs.detailFeeModel.close()
    },
    // 更新报告
    getNewRisk(type){
      getNewRisk({
        uid:this.nowItem.uid,
        order_id:this.nowItem.id,
        type:type
      }).then(res=>{
        this.loading=false
        if(res.status===200){
          this.$util.Tips({title:'更新成功'})
          // 司法列表
          if(type===6){
            this.detail = res.data.allList
          }
          // 司法数据
          if(type===5){
            this.detail = res.data.detail
          }
          this.$refs.popModel.close()
          // 更新状态
          this.$emit('refresh')
        }
      })
    },
  },
}
</script>

<style lang="scss" scoped>
.wrap{
  padding: 20rpx;
}
.item{
  margin-bottom: 20rpx;
  padding: 20rpx 30rpx;
  background: #fff;
  border-radius: 20rpx;
  .item-row{
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12rpx;
    .l{
      width: 30%;
      display: flex;
      align-items: center;
    }
  }
  .btn-box{
    display: flex;
    justify-content: flex-end;

  }
}

.first-tip{
  padding: 0 60rpx;
  position: absolute;
  top: 40%;
}

.btn-color{
  white-space: nowrap;
  padding: 0 24rpx;
  height: 56rpx;
  line-height: 54rpx;
  text-align: center;
  border-radius: 28rpx;
  font-size: 24rpx;
  color: #fff;
  transform: rotateZ(360deg);
  background: #1497fa;
}

.footer{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100upx;
  position: fixed;
  bottom: 0;
  left: 0;
  background-color: #fff;
  padding: 0 30upx;
  border-top: 1px solid #eee;
  height: calc(100rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  height: calc(100rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  padding-bottom: calc(0rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  padding-bottom: calc(0rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
}

.pop-box{
  width: 90vw;
  max-height: 66vh;
  padding: 30rpx;
  border-radius: 28rpx;
  background: #fff;
  display: flex;
  flex-direction: column;
  .title{
    font-size: 30rpx;
    margin-bottom: 30rpx;
    font-weight: bold;
  }
  .content{
    flex: 1;
    overflow-y: auto;
    .item-second{
      padding: 10rpx;
      border: 1rpx dashed #999;
      margin-bottom: 20rpx;
    }
  }
  .btn-box{
    display: flex;
    justify-content: center;
    margin-top: 30rpx;
    .btn{
      padding: 0 50rpx;
      line-height: 60rpx;
      border-radius: 28rpx;
    }
    .cancel{
      color: #333;
      border: 1rpx solid #CCCCCC;
      margin-right: 30rpx;
    }
    .confirm{
      color: #fff;
      background: #1497fa;
    }
  }
}

.tab-scroll{
  width: 100%;
  background: #fff;
  margin-bottom: 20rpx;
  .tab-box{
    display: flex;
    align-items: center;
    text{
      padding-right: 50rpx;
      white-space: nowrap;
      position: relative;
      .badge-box{
        position: absolute;
        top: -28rpx;
        right: 12rpx;
      }
    }
    .active {
      color: #1496f9 !important;
      font-weight: bold;
      font-size: 30rpx !important;
    }
  }
}
</style>